// pages/picture/picture.js
import resource from '../../libs/resource.js'

Page({
  data: {
    pictureFuns: [{
      name: '照片识别',
      url: "./pictureIdtt/pictureIdtt",
      color: ''
    }, {
      name: '照片处理',
      url: "./pictureDeal/pictureDeal",
      color: ''
    }],
    imageIndex: 0,
    showGallery: false,
    imageRes: resource.picture_imageRes
  },
  onLoad: function (options) {
    this.setData({
      onling: getApp().globalData.onling,
    })
    if (this.data.onling)
      this.setData({
        pictureFuns: [],
        imageRes: []
      })
  },
  onShareAppMessage() {

  },
  //图片功能按钮点击监听
  pictureFunClick(e) {
    console.log(e)
    var url = e.currentTarget.dataset.url
    wx.navigateTo({
      url: url
    })
  },
  //图片点击
  _image_click(event) {
    console.log(event)
    var idx = event.currentTarget.dataset.idx
    this.setData({
      imageIndex: idx,
      showGallery: true
    })
  }
})